package com.youu.youu.manager.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.druid.support.json.JSONUtils;
import com.atguigu.util.CommonUtils;
import com.youu.youu.manager.bean.TPermiss;
import com.youu.youu.manager.service.PermissBackstageService;


@Controller
@RequestMapping("permiss")
public class PermissBackstageController {
	@Autowired
	PermissBackstageService pBackstageService;
	
	@RequestMapping("permisses")
	public String getAllPermiss(Model model) {
		List<TPermiss> list = pBackstageService.getUnProcessAllPermiss();
		String json = CommonUtils.convertObjToJson(list);
		model.addAttribute("permisses", json);
		return "permiss";
	}
	
	@ResponseBody
	@RequestMapping("savePermiss")
	public List<TPermiss> savePermiss(@RequestBody List<TPermiss> list) {
		System.out.println("到保存权限");
		System.out.println(list);
		return list;
	}
	
	
	
	
}
